/* pages/ad-manage/ad-manage.less */

// --- 颜色和字体变量 ---
@text-primary: #303133;
@text-regular: #606266;
@text-secondary: #909399;
@text-placeholder: #c0c4cc;

@color-theme: #19be6b;
@color-danger: #f56c6c;
@color-warning: #f9ae3d;

@font-lg: 28rpx;
@font-md: 26rpx;
@font-sm: 24rpx;
@font-xs: 22rpx;

// --- 页面基础样式 ---

.ad-container {
  padding: 24rpx;
  padding-bottom: 180rpx;
}

// --- 广告卡片样式 ---
.ad-item {
  background-color: #fff;
  border-radius: 16rpx;
  margin-bottom: 24rpx;
  overflow: hidden;
  transition: all 0.3s ease;
}

.ad-image {
  width: 100%;
  display: block;
  background-color: #f2f2f2;
}

.ad-content {
  padding: 24rpx;
}

.ad-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20rpx;

  .ad-remark {
    font-size: @font-lg;
    color: @text-primary;
    font-weight: 600;
    line-height: 1.5;
    flex: 1;
    padding-right: 20rpx;
  }

  .delete-btn {
    width: 44rpx;
    height: 44rpx;
    background-color: fade(@color-danger, 10%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: background-color 0.2s;

    &:active {
      background-color: fade(@color-danger, 20%);
    }

    .delete-icon {
      color: @color-danger;
      font-size: 24rpx;
      font-weight: bold;
    }
  }
}

.ad-details {
  .detail-item {
    display: flex;
    align-items: center;
    margin-bottom: 12rpx;
    font-size: @font-sm;

    .label {
      color: @text-secondary;
      flex-shrink: 0;
    }

    .value {
      color: @text-regular;
      word-break: break-all;
    }

    .link {
      color: @color-theme;
      text-decoration: underline;
    }
  }
}

.ad-actions {
  margin-top: 20rpx;
  padding-top: 20rpx;
  border-top: 1rpx solid #ebedf0;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .label {
    font-size: @font-md;
    color: @text-primary;
  }

  .switch-wrapper {
    display: flex;
    align-items: center;
  }
}

// --- 悬浮添加按钮 ---
.add-fab-button {
  position: fixed !important;
  z-index: 9;
  right: 40rpx;
  background-color: @color-theme;
  display: flex;
  justify-content: center;
  align-self: center;
  line-height: 100rpx;
  font-weight: bold;
  font-size: 40rpx;
  color: #fff;
  border-radius: 50% !important;
  bottom: 100rpx;
  height: 100rpx;
  width: 100rpx;
  box-shadow: 0 8rpx 20rpx rgba(25, 190, 107, 0.4);
  &.active{
    background-color: #fff;
  }
}

// --- 空状态 ---
.empty-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 20vh;

  .empty-image {
    width: 280rpx;
    height: 280rpx;
  }

  .empty-text {
    margin-top: 20rpx;
    font-size: @font-md;
    color: @text-secondary;
  }
}

// --- 骨架屏 ---
.skeleton-wrapper {
  .skeleton-item {
    background-color: #fff;
    border-radius: 16rpx;
    margin-bottom: 24rpx;
    overflow: hidden;
  }

  .skeleton-image {
    width: 100%;
    height: 320rpx;
    background: #f2f2f2;
  }

  .skeleton-content {
    padding: 24rpx;
  }

  .skeleton-line {
    height: 32rpx;
    background: #f2f2f2;
    border-radius: 8rpx;
    margin-bottom: 20rpx;
    background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
  }
}

// --- 动画 ---
.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20rpx);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

// --- 弹出层样式 ---
.add-popup-content {
  padding: 32rpx;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;

  .popup-title {
    font-size: 36rpx;
    color: @text-primary;
    font-weight: 600;
    text-align: center;
    margin-bottom: 40rpx;
    flex-shrink: 0;
  }
}

.form-area {
  flex: 1;
  overflow-y: auto;
}

.form-item {
  background-color: #f7f8fa;
  border-radius: 16rpx;
  padding: 24rpx;
  margin-bottom: 24rpx;

  .form-label {
    font-size: @font-md;
    color: @text-primary;
    margin-bottom: 20rpx;
    display: block;

    .required-mark {
      color: @color-danger;
      margin-right: 4rpx;
    }
  }

  // 穿透van-field的组件样式
  :deep(.van-cell) {
    padding: 0;
    background-color: transparent;

    &::after {
      display: none;
    }
  }
}

.uploader-area {
  width: 100%;
  height: 320rpx;
  border: 2rpx dashed @text-placeholder;
  border-radius: 16rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background-color: #fff;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;

  &:active {
    border-color: @color-theme;
  }

  .uploader-placeholder {
    text-align: center;
    color: @text-secondary;

    .icon-plus {
      font-size: 60rpx;
      color: @text-placeholder;
      font-weight: 100;
      line-height: 1;
    }

    .text {
      font-size: @font-sm;
      margin-top: 16rpx;
    }
  }

  .uploader-preview {
    width: 100%;
    height: 100%;
  }

  .uploader-reupload {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: @font-sm;
    text-align: center;
    padding: 16rpx 0;
  }
}

.popup-actions {
  flex-shrink: 0;
  padding-top: 20rpx;

  :deep(.van-button) {
    margin: 0;
  }
}